﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Cs2102BookingSystem.Models.FACILITIES>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	AdvancedFacilitiesSearch
</asp:Content>
<script runat="server">
    
    int _submitted = 0;
    public void Page_Load()
    {
        _submitted = Int32.Parse(ViewData["_submittedFacilities"].ToString()); ;
        if (_submitted == 1)
        {
            ResultPanel.Visible = true;
        }
        else
        {
            ResultPanel.Visible = false;
        }
    }

    

</script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

   <h2>Advanced Search</h2>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        
           <fieldset>
             <div class="editor-label">
                
             <table>
             <tr>
                <th style="width:10px">
                    <td style="width: 20px">Facilities:</td>
                    <td>
                    <%: Html.DropDownListFor(model => model.FACILITY, (SelectList)ViewData["facilitylist"], "-- Select One --", new Dictionary<string, object> { { "id", "FACILITY" }, { "runat", "server" }, { "AutoPostBack", "true" }, { "onchange", "this.form.submit()" } })%>
                    </td>
                    <td colspan=2 style=" width: 30px" >
                    <%: Html.ValidationMessageFor(model => model.FACILITY) %>
                    </td>
                </th>

                </tr>
              
            </table>   
            </div>
            
           
        </fieldset>

    <% } %>

    <asp:panel id="ResultPanel" runat="server" visible="false">
         <% Html.RenderAction("AdvancedFacilitiesSearchResult", "Search", new { _facility = Model.FACILITY });%>
       
    </asp:panel>


    <div>
        <%: Html.ActionLink("Back", "Index", "Home")%>
    </div>

</asp:Content>

